Skip to content

fix(sonar): harden tailnet path before SonarQube scan (roll out infra-portal#1179) - #322

Merged
sudheer-monta merged 1 commit into
mainfrom
fix/harden-tailscale-sonar-rollout
Jul 21, 2026
Merged

fix(sonar): harden tailnet path before SonarQube scan (roll out infra-portal#1179)#322
sudheer-monta merged 1 commit into
mainfrom
fix/harden-tailscale-sonar-rollout

Conversation

@sudheer-monta

Copy link
Copy Markdown
Contributor

What

Ports the tailscale-hardening fix from infra-portal#1179 into the two shared reusable workflows so it rolls out to every Kotlin service at once (all consumers pin @main):

  • pull-request-kotlin.yml — before Upload results to SonarQube
  • sonar-cloud.yml — before Analyze with SonarQube

Adds a "Wait for SonarQube to be reachable over the tailnet" step: a curl probe that polls https://sonarqube.vpn.internal.monta.app/api/v2/analysis/version (the exact endpoint the scanner hits first) until it answers, then lets the scan proceed.

Why

tailscale up returns before the DERP/route path has actually settled (we can't do direct connections, so traffic relays via DERP). The scanner's first call hits a half-open path and fails fast — its default connect timeout is only 5s — surfacing as the cryptic:

Failed to query server version: Call to URL [.../api/v2/analysis/version] failed: null

This has been forcing several CI retries across service-ocpp, service-notifications, service-data-broker, service-alerts, etc. Polling the endpoint both waits out the race and warms the relay path, so the scan starts on a connection we know works.

Safety / composition

Follow-ups (not in this PR)

  • Optional: raise the Gradle sonar scanner connectTimeout/responseTimeout (infra-portal#1179 also did this, but there Sonar runs via sonarqube-scan-action; here it runs via the gradle-multi-module action, so it'd need to go through gradle args).
  • Longer term (per Jonas): move Sonar to self-hosted runners on the same network as SonarQube to drop the VPN dependency entirely.

Picks up the rollout Jonas flagged in #request-sre / #github.

🤖 Generated with Claude Code

`tailscale up` returns before the DERP/route path has settled, so the
scanner's first call (GET /api/v2/analysis/version) can hit a half-open
path and fail fast with "Failed to query server version ... failed: null".
The scanner's default connect timeout is only 5s, so this surfaces as a
flaky Sonar failure requiring several CI retries across Kotlin services
(ocpp, notifications, data-broker, alerts, ...).

Port the hardening Jonas landed in infra-portal#1179 into the two shared
reusable workflows so every consumer (@main) picks it up at once: add a
curl probe that polls the exact health endpoint until reachable before
the scan runs. This both waits out the race and warms the relay path.

Guarded with the same conditions as the scan step and
`continue-on-error: sonar-non-blocking`, so it composes with the existing
non-blocking behaviour (#320/#321) and the SonarCloud path when Tailscale
is skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sudheer-monta
sudheer-monta requested a review from a team as a code owner July 21, 2026 03:59
@sudheer-monta
sudheer-monta requested review from maoanran and removed request for a team July 21, 2026 03:59
@sudheer-monta
sudheer-monta merged commit 6f1473e into main Jul 21, 2026
1 check passed
@sudheer-monta
sudheer-monta deleted the fix/harden-tailscale-sonar-rollout branch July 21, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants